winsafe\mf\com_interfaces/
imfvideodisplaycontrol.rs1#![allow(non_camel_case_types, non_snake_case)]
2
3use crate::co;
4use crate::decl::*;
5use crate::kernel::privs::*;
6use crate::mf::vts::*;
7use crate::ole::privs::*;
8use crate::prelude::*;
9
10com_interface! { IMFVideoDisplayControl: "a490b1e4-ab84-4d31-a1b2-181e03b1077a";
11 }
33
34impl mf_IMFVideoDisplayControl for IMFVideoDisplayControl {}
35
36pub trait mf_IMFVideoDisplayControl: ole_IUnknown {
45 #[must_use]
48 fn GetAspectRatioMode(&self) -> HrResult<co::MFVideoARMode> {
49 let mut mode = co::MFVideoARMode::default();
50 ok_to_hrresult(unsafe {
51 (vt::<IMFVideoDisplayControlVT>(self).GetAspectRatioMode)(self.ptr(), mode.as_mut())
52 })
53 .map(|_| mode)
54 }
55
56 #[must_use]
59 fn GetBorderColor(&self) -> HrResult<COLORREF> {
60 let mut color = COLORREF::default();
61 ok_to_hrresult(unsafe {
62 (vt::<IMFVideoDisplayControlVT>(self).GetBorderColor)(self.ptr(), color.as_mut())
63 })
64 .map(|_| color)
65 }
66
67 #[must_use]
70 fn GetFullscreen(&self) -> HrResult<bool> {
71 let mut fulls = 0;
72 ok_to_hrresult(unsafe {
73 (vt::<IMFVideoDisplayControlVT>(self).GetFullscreen)(self.ptr(), &mut fulls)
74 })
75 .map(|_| fulls != 0)
76 }
77
78 #[must_use]
83 fn GetIdealVideoSize(&self) -> HrResult<(SIZE, SIZE)> {
84 let (mut min, mut max) = (SIZE::default(), SIZE::default());
85 ok_to_hrresult(unsafe {
86 (vt::<IMFVideoDisplayControlVT>(self).GetIdealVideoSize)(
87 self.ptr(),
88 pvoid(&mut min),
89 pvoid(&mut max),
90 )
91 })
92 .map(|_| (min, max))
93 }
94
95 #[must_use]
100 fn GetNativeVideoSize(&self) -> HrResult<(SIZE, SIZE)> {
101 let (mut native, mut aspec) = (SIZE::default(), SIZE::default());
102 ok_to_hrresult(unsafe {
103 (vt::<IMFVideoDisplayControlVT>(self).GetNativeVideoSize)(
104 self.ptr(),
105 pvoid(&mut native),
106 pvoid(&mut aspec),
107 )
108 })
109 .map(|_| (native, aspec))
110 }
111
112 #[must_use]
115 fn GetVideoPosition(&self) -> HrResult<(MFVideoNormalizedRect, RECT)> {
116 let mut norm_rc = MFVideoNormalizedRect::default();
117 let mut rc = RECT::default();
118
119 ok_to_hrresult(unsafe {
120 (vt::<IMFVideoDisplayControlVT>(self).GetVideoPosition)(
121 self.ptr(),
122 pvoid(&mut norm_rc),
123 pvoid(&mut rc),
124 )
125 })
126 .map(|_| (norm_rc, rc))
127 }
128
129 #[must_use]
132 fn GetVideoWindow(&self) -> HrResult<HWND> {
133 let mut hwnd = HWND::NULL;
134 ok_to_hrresult(unsafe {
135 (vt::<IMFVideoDisplayControlVT>(self).GetVideoWindow)(self.ptr(), hwnd.as_mut())
136 })
137 .map(|_| hwnd)
138 }
139
140 fn RepaintVideo(&self) -> HrResult<()> {
143 match unsafe {
144 co::HRESULT::from_raw((vt::<IMFVideoDisplayControlVT>(self).RepaintVideo)(self.ptr()))
145 } {
146 co::HRESULT::S_OK | co::HRESULT::MF_E_INVALIDREQUEST => Ok(()),
147 hr => Err(hr),
148 }
149 }
150
151 fn SetAspectRatioMode(&self, mode: co::MFVideoARMode) -> HrResult<()> {
154 ok_to_hrresult(unsafe {
155 (vt::<IMFVideoDisplayControlVT>(self).SetAspectRatioMode)(self.ptr(), mode.raw())
156 })
157 }
158
159 fn SetBorderColor(&self, color: COLORREF) -> HrResult<()> {
162 ok_to_hrresult(unsafe {
163 (vt::<IMFVideoDisplayControlVT>(self).SetBorderColor)(self.ptr(), color.into())
164 })
165 }
166
167 fn SetFullscreen(&self, full_screen: bool) -> HrResult<()> {
170 ok_to_hrresult(unsafe {
171 (vt::<IMFVideoDisplayControlVT>(self).SetFullscreen)(self.ptr(), full_screen as _)
172 })
173 }
174
175 fn SetRenderingPrefs(&self, render_flags: co::MFVideoRenderPrefs) -> HrResult<()> {
178 ok_to_hrresult(unsafe {
179 (vt::<IMFVideoDisplayControlVT>(self).SetRenderingPrefs)(self.ptr(), render_flags.raw())
180 })
181 }
182
183 fn SetVideoPosition(
188 &self,
189 src: Option<MFVideoNormalizedRect>,
190 dest: Option<RECT>,
191 ) -> HrResult<()> {
192 ok_to_hrresult(unsafe {
193 (vt::<IMFVideoDisplayControlVT>(self).SetVideoPosition)(
194 self.ptr(),
195 pcvoid_or_null(src.as_ref()),
196 pcvoid_or_null(dest.as_ref()),
197 )
198 })
199 }
200
201 fn SetVideoWindow(&self, hwnd_video: &HWND) -> HrResult<()> {
204 ok_to_hrresult(unsafe {
205 (vt::<IMFVideoDisplayControlVT>(self).SetVideoWindow)(self.ptr(), hwnd_video.ptr())
206 })
207 }
208}